package cn.iocoder.yudao.module.system.controller.admin.studentdashboard.vo;

import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

import java.math.BigDecimal;
import java.util.List;

@Schema(description = "管理后台 - 学生排名信息 Response VO")
@Data
public class StudentRankingRespVO {

    @Schema(description = "学生基本信息")
    private StudentBasicInfo studentInfo;

    @Schema(description = "班级排名信息")
    private ClassRankingInfo classRanking;

    @Schema(description = "年级排名信息")
    private GradeRankingInfo gradeRanking;

    @Schema(description = "各科排名信息")
    private List<SubjectRankingInfo> subjectRankings;

    /**
     * 学生基本信息
     */
    @Data
    public static class StudentBasicInfo {
        @Schema(description = "学生ID", example = "1001")
        private Long studentId;

        @Schema(description = "学生姓名", example = "张三")
        private String studentName;

        @Schema(description = "学号", example = "G3C1001")
        private String studentNo;

        @Schema(description = "班级名称", example = "高三(1)班")
        private String className;

        @Schema(description = "总分", example = "684.5")
        private BigDecimal totalScore;
    }

    /**
     * 班级排名信息
     */
    @Data
    public static class ClassRankingInfo {
        @Schema(description = "班级排名", example = "1")
        private Integer rank;

        @Schema(description = "班级总人数", example = "45")
        private Integer totalCount;

        @Schema(description = "百分位排名", example = "97.8")
        private BigDecimal percentile;

        @Schema(description = "超过人数", example = "44")
        private Integer beatCount;

        @Schema(description = "班级平均分", example = "620.5")
        private BigDecimal avgScore;

        @Schema(description = "班级最高分", example = "684.5")
        private BigDecimal maxScore;

        @Schema(description = "班级最低分", example = "520.0")
        private BigDecimal minScore;

        @Schema(description = "前后排名学生信息")
        private List<RankingStudentInfo> nearbyStudents;
    }

    /**
     * 年级排名信息
     */
    @Data
    public static class GradeRankingInfo {
        @Schema(description = "年级排名", example = "2")
        private Integer rank;

        @Schema(description = "年级总人数", example = "200")
        private Integer totalCount;

        @Schema(description = "百分位排名", example = "99.0")
        private BigDecimal percentile;

        @Schema(description = "超过人数", example = "198")
        private Integer beatCount;

        @Schema(description = "年级平均分", example = "580.5")
        private BigDecimal avgScore;

        @Schema(description = "年级最高分", example = "720.0")
        private BigDecimal maxScore;

        @Schema(description = "年级最低分", example = "450.0")
        private BigDecimal minScore;

        @Schema(description = "前后排名学生信息")
        private List<RankingStudentInfo> nearbyStudents;
    }

    /**
     * 科目排名信息
     */
    @Data
    public static class SubjectRankingInfo {
        @Schema(description = "科目名称", example = "数学")
        private String subjectName;

        @Schema(description = "成绩", example = "145.0")
        private BigDecimal score;

        @Schema(description = "满分", example = "150.0")
        private BigDecimal fullScore;

        @Schema(description = "班级排名", example = "1")
        private Integer classRank;

        @Schema(description = "年级排名", example = "3")
        private Integer gradeRank;

        @Schema(description = "班级总人数", example = "45")
        private Integer classTotalCount;

        @Schema(description = "年级总人数", example = "200")
        private Integer gradeTotalCount;

        @Schema(description = "班级百分位", example = "97.8")
        private BigDecimal classPercentile;

        @Schema(description = "年级百分位", example = "98.5")
        private BigDecimal gradePercentile;

        @Schema(description = "班级平均分", example = "128.5")
        private BigDecimal classAvgScore;

        @Schema(description = "年级平均分", example = "125.2")
        private BigDecimal gradeAvgScore;

        @Schema(description = "超过班级平均分", example = "16.5")
        private BigDecimal aboveClassAvg;

        @Schema(description = "超过年级平均分", example = "19.8")
        private BigDecimal aboveGradeAvg;
    }

    /**
     * 排名附近学生信息
     */
    @Data
    public static class RankingStudentInfo {
        @Schema(description = "学生姓名", example = "李四")
        private String studentName;

        @Schema(description = "学号", example = "G3C1002")
        private String studentNo;

        @Schema(description = "班级名称", example = "高三(1)班")
        private String className;

        @Schema(description = "排名", example = "2")
        private Integer rank;

        @Schema(description = "总分", example = "680.0")
        private BigDecimal totalScore;

        @Schema(description = "与当前学生的分差", example = "4.5")
        private BigDecimal scoreDifference;
    }

}
